{extend name="../../base/view/common/base" /}
<!-- 主体 -->
{block name="body"}
<form class="layui-form p-4">

	<div class="layui-form-item link-type">
		<label class="layui-form-label label-required">单据日期</label>
		<div class="layui-input-block">
			<input id="orderDate" name="orderDate" value="{$info.orderDate|default=date('Y-m-d')}" lay-verify="required" lay-reqText="请选择时间"  readonly placeholder="请选择时间" class="layui-input">
		</div>
	</div>
	<div class="layui-form-item link-type">
		<label class="layui-form-label label-required">使用金额</label>
		<div class="layui-input-block">
			<input name="money" value='{$info.money|default=""}' maxlength="9" lay-verify="required" lay-reqText="请输入金额" onkeyup="digitalFiltering(this,2)" placeholder="请输入金额" class="layui-input">
		</div>
	</div>
	<div class="layui-form-item link-type">
		<label class="layui-form-label label-required">类型</label>
		<div class="layui-input-block">
			<select name="mType" id="">
				<option value="1">收入</option>
				<option value="2">支出</option>
			</select>
		</div>
	</div>
	<div class="layui-form-item link-type">
		<label class="layui-form-label label-required">备注</label>
		<div class="layui-input-block">
			<input name="remark" value='{$info.remark|default=""}'  lay-reqText="请输入备注" o placeholder="请输入备注" class="layui-input">
		</div>
	</div>
	<div class="py-3">
		<input type="hidden" name="id" value="{$id}">
		{if !isset($detail.status)||$detail.status==1}
		<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">保存</button>
		<button type="reset" class="layui-btn layui-btn-primary">重置</button>
		{/if}
	</div>
</form>
{/block}
<!-- /主体 -->

<!-- 脚本 -->
{block name="script"}
<script>
	const moduleInit = ['tool'];
	function gouguInit() {
		var form = layui.form,tool=layui.tool,level=0;


		//监听提交
		form.on('submit(webform)', function (data) {
			let callback = function (e) {
				layer.msg(e.msg);
				if (e.code == 0) {
					setTimeout(function(){
						parent.parent.location.reload();
					},1000);									
				}
			}
			tool.post("add", data.field, callback);
			return false;
		});
		form.on("select(categorySelect)",function (data) {
			let category=data.value;
			$("#category").val(category);
		})
		layui.laydate.render({
			elem:"#orderDate",
			type:"yyyy-mm-dd"
		})

	}

</script>
{/block}
<!-- /脚本 -->